home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97b.txt / 000074_icon-group-sender _Mon Sep 22 12:50:06 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by cheltenham.cs.arizona.edu (8.8.7/8.8.7) with SMTP id MAA21908
  4.     for <icon-group-addresses@cheltenham.CS.Arizona.EDU>; Mon, 22 Sep 1997 12:50:06 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA07364; Mon, 22 Sep 1997 12:50:05 -0700
  7. From: gep2@computek.net
  8. Date: Mon, 22 Sep 1997 11:44:25 -0500
  9. Message-Id: <199709221644.LAA08065@axp.cmpu.net>
  10. Mime-Version: 1.0
  11. Content-Type: text/plain
  12. Content-Transfer-Encoding: 7bit
  13. Subject: if not find a and/or b, do x
  14. To: icon-group@cs.arizona.edu
  15. X-Mailer: SPRY Mail Version: 04.00.06.17
  16. Errors-To: icon-group-errors@cs.arizona.edu
  17. Status: RO
  18.  
  19. >I want to write up a little program that does, among other things, some
  20. error checking for me.  Basically, if the program finds a certain element
  21. in a line, I want it to look for two other elements and to write the line
  22. if one or both of those two other elements are missing.
  23.  
  24. >Ex.
  25. if find( "{T" ) 
  26.     then if not find( "{A" | "{O" )
  27.             then write( line )
  28. should write (1), (2), and (3), but not (4)
  29. 1. {T
  30. 2. {T {A
  31. 3. {T {O
  32. 4. {T {O {A
  33.  
  34. Here is a SNOBOL4+/SPITBOL version:
  35.  
  36.     &fullscan = 1
  37. next    line = input ?(atag = otag = ttag = )        :f(end)
  38.     line fence breakx("{") len(1) ("T" $ ttag | "O" $ otag | "A" $ atag)
  39. +      *differ(atag) *differ(otag) *differ(ttag)
  40.     output = differ(ttag) ~(differ(otag) differ(atag)) line    :(next)
  41. end
  42.  
  43. Gordon Peterson
  44. http://www.computek.net/public/gep2/
  45. Support the Anti-SPAM Amendment!  Join at http://www.cauce.org/
  46.  
  47.